import React, { useEffect, useRef, useState } from 'react';
import ReactDOM from 'react-dom'
const MiniApp = ({ ...props }) => {
 const ref =  useRef(null)
  const [appEl,setAppEl] = useState(null);
  useEffect(() => {
    
    // console.log("requirejs",window.requirejs);
    (window as any).requirejs(['https://static.weillan.com/www/biz-dev/weillan-saas-account/1.18.0/static/pages/account/login.js'], (res) => {
      console.log('errr', ref.current)
      const Rc = res.default
      // ReactDOM.render(<Rc/>,ref.current)
      setAppEl(<Rc/>)
    })
  }, [])
  if(appEl){
    return appEl
  }
  console.log('props', props)
  return (<div ref={ref} />)
}
export default React.memo(MiniApp,()=>true)